package com.epi.one.basic.generic;

/**
 * @author dxy
 * @version 1.0
 */
import java.util.*;
import java.util.function.*;

public class GenericExample<K extends Number,V,U > extends Date  implements Comparator , Function<K,U> {

    private K key;
    private V value;

    public GenericExample(K key, V value) {
        this.key = key;
        this.value = value;
    }

    public K getKey() {
        return key;
    }

    public V getValue() {
        return value;
    }

    // 泛型方法，声明了自己的类型参数T
    public <T> List<T> toList(T element) {
        return List.of(element);
    }

    // 泛型方法，返回泛型Map.Entry
    public <T extends Comparable<T>> Map.Entry<T, V> createEntry(T key, V value) {
        return Map.entry(key, value);
    }

    public static <T> void of(T element) {
        System.out.println(element);
    }

    public static void wildOf(List<? extends Number> list) {
        System.out.println(list);
    }


    @Override
    public int compare(Object o1, Object o2) {
        return 0;
    }

    @Override
    public U apply(K k) {
        return null;
    }
}
